﻿using SLS.ExClassLib.MultiThreading.Patterns;
using Microsoft.Practices.Unity;

namespace SLS.ExClassLib.MultiThreading
{
    public static class ServiceContainer
    {
        private static readonly Singleton<IUnityContainer> _container =
            new Singleton<IUnityContainer>(() => new UnityContainer());

        public static IUnityContainer Container
        {
            get { return _container.Value; }
        }

        public static T Resolve<T>()
        {
            return Container.Resolve<T>();
        }

        public static T Resolve<T>(string name)
        {
            return Container.Resolve<T>(name);
        }

        public static T BuildUp<T>(T existing)
        {
            return Container.BuildUp(existing);
        }
    }
}